﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

//Write a program to calculate the sum (with accuracy of 0.001): 1 + 1/2 - 1/3 + 1/4 - 1/5 + ...


namespace _10SumWithAccuracy
{
    class _10SumWithAccuracy
    {
        static void Main(string[] args)
        {
            decimal a = 1;
            decimal b = 2;
            decimal c = 0;
            decimal sum = 0;
            
            for (int i = 0; i <= 1000; i++)
            {
                c = (a/b - a/++b);
                ++b;
                sum = sum + c;
            }
            sum = 1 + sum;
            Console.WriteLine(Math.Round(sum, 3));
        }
    }
}
